System, method and article of manufacture for a programmable processing model with instruction set

ABSTRACT

A system, method and article of manufacture are provided for programmable processing in a computer graphics pipeline. Initially, data is received from a source buffer. Thereafter, programmable operations are performed on the data in order to generate output. The operations are programmable in that a user may utilize instructions from a predetermined instruction set for generating the same. Such output is stored in a register. During operation, the output stored in the register is used in performing the programmable operations on the data.

RELATED APPLICATION

The present application is a divisional of an application entitled“SYSTEM, METHOD AND ARTICLE OF MANUFACTURE FOR A PROGRAMMABLE VERTEXPROCESSING MODEL WITH INSTRUCTION SET” filed May 31, 2000 now U.S. Pat.No. 7,209,140 under Ser. No. 09/586,249 which, in turn, is acontinuation-in-part of an application entitled “METHOD, APPARATUS ANDARTICLE OF MANUFACTURE FOR A TRANSFORM MODULE IN A GRAPHICS PROCESSOR”filed Dec. 6, 1999 now U.S. Pat. No. 6,353,439 under Ser. No. 09/456,102which is incorporated herein by reference in its entirety.

FIELD OF THE INVENTION

The present invention relates to computer graphics, and moreparticularly to providing programmability in a computer graphicsprocessing pipeline.

BACKGROUND OF THE INVENTION

Graphics application program interfaces (API's) have been instrumentalin allowing applications to be written to a standard interface and to berun on multiple platforms, i.e. operating systems. Examples of suchgraphics API's include Open Graphics Library (OpenGL®) and D3D™transform and lighting pipelines. OpenGL® is the computer industry'sstandard graphics API for defining 2-D and 3-D graphic images. WithOpenGL®, an application can create the same effects in any operatingsystem using any OpenGL®-adhering graphics adapter. OpenGL® specifies aset of commands or immediately executed functions. Each command directsa drawing action or causes special effects.

Thus, in any computer system which supports this OpenGL® standard, theoperating system(s) and application software programs can make callsaccording to the standard, without knowing exactly any specificsregarding the hardware configuration of the system. This is accomplishedby providing a complete library of low-level graphics manipulationcommands, which can be used to implement graphics operations.

A significant benefit is afforded by providing a predefined set ofcommands in graphics API's such as OpenGL®. By restricting the allowableoperations, such commands can be highly optimized in the driver andhardware implementing the graphics API. On the other hand, one majordrawback of this approach is that changes to the graphics API aredifficult and slow to be implemented. It may take years for a newfeature to be broadly adopted across multiple vendors.

With the impending integration of transform operations into high speedgraphics chips and the higher integration levels allowed bysemiconductor manufacturing, it is now possible to make part of thegeometry pipeline accessible to the application writer. There is thus aneed to exploit this trend in order to afford increased flexibility invisual effects. In particular, there is a need to provide a new computergraphics programming model and instruction set that allows convenientimplementation of changes to the graphics API, while preserving thedriver and hardware optimization afforded by currently establishedgraphics API's.

SUMMARY OF THE INVENTION

A system, method and article of manufacture are provided forprogrammable processing in a computer graphics pipeline. Initially, datais received from a source buffer. Thereafter, programmable operationsare performed on the data in order to generate output. The operationsare programmable in that a user may utilize instructions from apredetermined instruction set for generating the same. Such output isstored in a register. During operation, the output stored in theregister is used in performing the programmable operations on the data.

By this design, the present invention allows a user to program a portionof the graphics pipeline that handles vertex processing. This results inan increased flexibility in generating visual effects. Further, theprogrammable vertex processing of the present invention allows remainingportions of the graphics pipeline, i.e. primitive processing, to becontrolled by a standard graphics application program interface (API)for the purpose of preserving hardware optimizations.

In one embodiment of the present invention, only one vertex is processedat a time in a functional module that performs the programmableoperations. Further, the various foregoing operations may be processedfor multiple vertices in parallel.

In another embodiment of the present invention, the data may include aconstant and/or vertex data. During operation, the constant may bestored in a constant source buffer and the vertex data may be stored ina vertex source buffer. Further, the constant may be accessed in theconstant source buffer using an absolute or relative address.

In still another embodiment of the present invention, the register maybe equipped with single write and triple read access. The output mayalso be stored in a destination buffer. The output may be stored in thedestination buffer under a predetermined reserved address.

As an option, the programmable vertex processing of the presentinvention may include negating the data. Still yet, the programmablevertex processing may also involve swizzling the data. Data swizzling isuseful when generating vectors. Such technique allows the efficientgeneration of a vector cross product and other vectors.

During operation, the programmable vertex processing is adapted forcarrying out various instructions of an instruction set. Suchinstructions may include, but are not limited to a no operation, addressregister load, move, multiply, addition, multiply and addition,reciprocal, reciprocal square root, three component dot product, fourcomponent dot product, distance vector, minimum, maximum, set on lessthan, set on greater or equal than, exponential base two (2), logarithmbase two (2), and/or light coefficients.

These various instructions may each be carried out using a uniqueassociated method and data structure. Such data structure includes asource location identifier indicating a source location of data to beprocessed. Such source location may include a plurality of components.Further provided is a source component identifier indicating in which ofthe plurality of components of the source location the data resides. Thedata may be retrieved based on the source location identifier and thesource component identifier. This way, the operation associated with theinstruction at hand may be performed on the retrieved data in order togenerate output.

Also provided is a destination location identifier for indicating adestination location of the output. Such destination location mayinclude a plurality of components. Further, a destination componentidentifier is included indicating in which of the plurality ofcomponents of the destination location the output is to be stored. Inoperation, the output is stored based on the destination locationidentifier and the destination component identifier.

These and other advantages of the present invention will become apparentupon reading the following detailed description and studying the variousfigures of the drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing and other aspects and advantages are better understoodfrom the following detailed description of a preferred embodiment of theinvention with reference to the drawings, in which:

FIG. 1 is a conceptual diagram illustrating a graphics pipeline inaccordance with one embodiment of the present invention;

FIG. 2 illustrates the overall operation of the various components ofthe graphics pipeline of FIG. 1;

FIG. 3 is a schematic illustrating one embodiment of a programming modelin accordance with the present invention;

FIG. 4 is a flowchart illustrating the method by which the programmingmodel of FIG. 3 carries out programmable vertex processing in thecomputer graphics pipeline; and

FIG. 5 is a flowchart illustrating the method in a data structure isemployed to carry out graphics instructions in accordance with oneembodiment of the present invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 is a conceptual diagram illustrating a graphics pipeline 100 inaccordance with one embodiment of the present invention. During use, thegraphics pipeline 100 is adapted to carry out numerous operations forthe purpose of processing computer graphics. Such operations may becategorized into two types, namely vertex processing 102 and primitiveprocessing 104. At least partially during use, the vertex processing 102and primitive processing 104 adhere to a standard graphics applicationprogram interface (API) such as OpenGL® or any other desired graphicsAPI.

Vertex processing 102 normally leads primitive processing 104, andincludes well known operations such as texgen operations, lightingoperations, transform operations, and/or any other operations thatinvolve vertices in the computer graphics pipeline 100.

Primitive processing 104 normally follows vertex processing 102, andincludes well known operations such as culling, frustum clipping,polymode operations, flat shading, polygon offsetting, fragmenting,and/or any other operations that involve primitives in the computergraphics pipeline 100. It should be noted that still other operationsmay be performed such as viewport operations.

FIG. 2 illustrates a high level operation 200 of the graphics pipeline100 of FIG. 1. As shown, it is constantly determined in decision 202whether current operation invokes a programmable geometry model of thepresent invention. If so, a mode is enabled that partially supercedesthe vertex processing 102 of the standard graphics API, thus providingincreased flexibility in generating visual effects. See operation 204.

When disabled, the present invention allows increased or exclusivecontrol of the graphics pipeline 100 by the standard graphics API, asindicated in operation 206. In one embodiment, states of the standardgraphics API state may not be overruled by invoking the programmablegeometry mode of the present invention. In one embodiment, no graphicsAPI state may be directly accessible by the present invention.

In one embodiment of the present invention, the programmable geometrymode of the present invention may optionally be limited to vertexprocessing from object space into homogeneous clip space. This is toavoid compromising hardware performance that is afforded by allowingexclusive control of the primitive processing 104 by the standardgraphics API at all times.

The remaining description will be set forth assuming that theprogrammable geometry mode supersedes the standard graphics API onlyduring vertex processing 102. It should be noted, however, that invarious embodiments of the present invention, the programmable geometrymode may also supersede the standard graphics API during primitiveprocessing 104.

FIG. 3 is a schematic illustrating one embodiment of a programming model300 in accordance with the present invention. Such programming model 300may be adapted to work with hardware accelerators of variousconfiguration and/or with central processing unit (CPU) processing.

As shown in FIG. 3, the programming module 300 includes a functionalmodule 302 that is capable of carrying out a plurality of differenttypes of operations. The functional module 302 is equipped with threeinputs and an output. Associated with each of the three inputs is aswizzling module 304 and a negating module 306 for purposes that will beset forth hereinafter in greater detail.

Coupled to the output of the functional module 302 is an input of aregister 308 having three outputs. Also coupled to the output of thefunctional module 302 is a vertex destination buffer 310. The vertexdestination buffer 310 may include a vector component write mask, andmay preclude read access.

Also included are a vertex source buffer 312 and a constant sourcebuffer 314. The vertex source buffer 312 stores data in the form ofvertex data, and may be equipped with write access and/or at leastsingle read access. The constant source buffer 314 stores data in theform of constant data, and may also be equipped with write access and/orat least single read access.

Each of the inputs of the functional module 302 is equipped with amultiplexer 316. This allows the outputs of the register 308, vertexsource buffer 312, and constant source buffer 314 to be fed to theinputs of the functional module 302. This is facilitated by buses 318.

FIG. 4 is a flowchart illustrating the method 400 by which the model ofFIG. 3 carries out programmable vertex processing in the computergraphics pipeline 100. Initially, in operation 402, data is receivedfrom a vertex source buffer 312. Such data may include any type ofinformation that is involved during the processing of vertices in thecomputer graphics pipeline 100. Further, the vertex source buffer 312may include any type of memory capable of storing data.

Thereafter, in operation 404, programmable operations, i.e. vertexprocessing 102, are performed on the data in order to generate output.The programmable operations are capable of generating output includingat the very least a position of a vertex in homogeneous clip space. Inone embodiment, such position may be designated using Cartesiancoordinates each with a normalized range between −1.0 and 1.0. Suchoutput is stored in the register 308 in operation 406. During operation408, the output stored in the register 308 is used in performing theprogrammable operations on the data. Thus, the register 308 may includeany type of memory capable of allowing the execution of the programmableoperations on the output.

By this design, the present invention allows a user to program a portionof the graphics pipeline 100 that handles vertex processing. Thisresults in an increased flexibility in generating visual effects.Further, the programmable vertex processing of the present inventionallows remaining portions of the graphics pipeline 100 to be controlledby the standard application program interface (API) for the purpose ofpreserving hardware optimizations.

During operation, only one vertex is processed at a time in thefunctional module 302 that performs the programmable operations. Assuch, the vertices may be processed independently. Further, the variousforegoing operations may be processed for multiple vertices in parallel.

In one embodiment of the present invention, a constant may be received,and the programmable operations may be performed based on the constant.During operation, the constant may be stored in and received from theconstant source buffer 314. Further, the constant may be accessed in theconstant source buffer 314 using an absolute or relative address. As anoption, there may be one address register for use during reads from theconstant source buffer 314. It may be initialized to 0 at the start ofprogram execution in operation 204 of FIG. 2. Further, the constantsource buffer 314 may be written with a program which may or may not beexposed to users.

The register 308 may be equipped with single write and triple readaccess. Register contents may be initialized to (0,0,0,0) at the startof program execution in operation 204 of FIG. 2. It should be understoodthat the output of the functional module 302 may also be stored in thevertex destination buffer 310. The vertex position output may be storedin the vertex destination buffer 310 under a predetermined reservedaddress. The contents of the vertex destination buffer 310 may beinitialized to (0,0,0,1) at the start of program execution in operation204 of FIG. 2.

As an option, the programmable vertex processing may include negatingthe data. Still yet, the programmable vertex processing may also involveswizzling the data. Data swizzling is useful when generating vectors.Such technique allows the efficient generation of a vector cross productand other vectors.

In one embodiment, the vertex source buffer 312 may be 16 quad-words insize (16*128 bits). Execution of the present invention may be commencedwhen Param[0]/Position is written. All attributes may be persistent.That is, they remain constant until changed. Table 1 illustrates theframework of the vertex source buffer 312. It should be noted that thenumber of textures supported may vary across implementations.

TABLE 1 Program Mode Standard API Param[0] X, Y, Z, W Position X, Y, Z,W Param[1] X, Y, Z, W Skin Weights W, W, W, W Param[2] X, Y, Z, W NormalX, Y, Z, * Param[3] X, Y, Z, W Diffuse Color R, G, B, A Param[4] X, Y,Z, W Specular Color R, G, B, A Param[5] X, Y, Z, W Fog F, *, *, *Param[6] X, Y, Z, W Point Size P, *, *, * Param[7] X, Y, Z, W *, *, *, *Param[8] X, Y, Z, W *, *, *, * Param[9] X, Y, Z, W Texture0 S, T, R, QParam[10] X, Y, Z, W Texture1 S, T, R, Q Param[11] X, Y, Z, W Texture2S, T, R, Q Param[12] X, Y, Z, W Texture3 S, T, R, Q Param[13] X, Y, Z, WTexture4 S, T, R, Q Param[14] X, Y, Z, W Texture5 S, T, R, Q Param[15]X, Y, Z, W Texture6 S, T, R, Q

In another embodiment, the vertex destination buffer 310 may be 13quad-words in size and may be deemed complete when the program isfinished. The following exemplary vertex destination buffer addressesare pre-defined to fit a standard pipeline. Contents are initialized to(0,0,0,1) at start of program execution in operation 204 of FIG. 2.Writes to locations that are not used by the downstream hardware may beignored.

A reserved address (HPOS) may be used to denote the homogeneous clipspace position of the vertex in the vertex destination buffer 310. Itmay be generated by the geometry program. Table 2 illustrates thevarious locations of the vertex destination buffer 310 and a descriptionthereof.

TABLE 2 Location Description HPOS HClip Position x, y, z, w (−1.0 to1.0) COL0 Color0 (diff) r, g, b, a (0.0 to 1.0) COL1 Color1 (spec) r, g,b, a (0.0 to 1.0) BCOL0 Color0 (diff) r, g, b, a (0.0 to 1.0) BCOL1Color1 (spec) r, g, b, a (0.0 to 1.0) FOGP Fog Parameter f, *, *, * PSIZPoint Size p, *, *, * TEX0 Texture0 s, t, r, q TEX1 Texture1 s, t, r, qTEX2 Texture2 s, t, r, q TEX3 Texture3 s, t, r, q

-   -   HPOS—homogeneous clip space position        -   float[4] x,y,z,w            -   standard graphics pipeline process further (clip check,                perspective divide, viewport scale and bias).    -   COL0/BCOL0—color0 (diffuse)    -   COL1/BCOL1—color1 (specular)        -   float[4] r,g,b,a            -   each component gets clamped to (0.0,1.0) before                interpolation            -   each component is interpolated at least as 8-bit                unsigned integer.    -   TEX0-7—textures 0 to 7        -   float [4] s,t,r,q            -   each component is interpolated as high precision float,                followed by division of q and texture lookup. Extra                colors could use texture slots. Advanced fog can be done                as a texture.    -   FOGP fog parameter        -   float[1] f (distance used in fog equation)            -   gets interpolated as a medium precision float and used                in a fog evaluation (linear, exp, exp2) generating a fog                color blend value.    -   PSIZ point size        -   float[1] p            -   gets clamped to (0.0,POINT_SIZE_MAX) and used as point                size.

An exemplary assembly language that may be used in one implementation ofthe present invention will now be set forth. In one embodiment, nobranching instructions may be allowed for maintaining simplicity. Itshould be noted, however, that branching may be simulated using variouscombinations of operations, as is well known to those of ordinary skill.Table 3 illustrates a list of the various resources associated with theprogramming model 300 of FIG. 3. Also shown in a reference formatassociated with each of the resources along with a proposed sizethereof.

TABLE 3 Resources: Vertex Source - v[*] of size 16 vectors (256B)Constant Memory - c[*] of size 192 vectors (1536B) Address Register -A0.x of size 1 signed integer (or multiple vectors) Data Registers -R0-R11,R12   of size 13 vectors (192B) Vertex Destination - o[*] of size11 vectors (208B) Instruction Storage of size 128 instructions Note: Alldata registers and memory locations may be four component floats.

For example, the constant source buffer 314 may be accessed as c[*](absolute) or as c[A0.x+*] (relative). In the relative case, a 32-bitsigned address register may be added to the read address. Out of rangeaddress reads may result in (0,0,0,0). In one embodiment, the vertexsource buffer 312, vertex destination buffer 310, and register 308 maynot use relative addressing.

Vector components may be swizzled before use via four subscripts (xyzw).Accordingly, an arbitrary component re-mapping may be done. Examples ofswizzling commands are shown in Table 4.

TABLE 4 .xyzw means source(x,y,z,w) → input(x,y,z,w) .zzxy meanssource(x,y,z,w) → input(z,z,x,y) .xxxx means source(x,y,z,w) →input(x,x,x,x)

Table 5 illustrates an optional shortcut notation of the assemblylanguage that may be permitted.

TABLE 5 No subscripts is the same as .xyzw .x is the same as .xxxx .y isthe same as .yyyy .z is the same as .zzzz .w is the same as .wwww

All source operands may be negated by putting a ‘−’ sign in front of theabove notation. Writes to the register 308 may be maskable. In otherwords, each component may be written only if it appears as a destinationsubscript (from xyzw). No swizzling may be possible for writes, andsubscripts may be ordered (x before y before z before w).

Writes to the vertex destination buffer 310 and/or the constant memory314 may also be maskable. Each component may be written only if itappears as a destination subscript (from xyzw). No swizzling may bepermitted for writes, and subscripts may be ordered (x before y before zbefore w).

An exemplary assembler format is as follows:

OPCODE DESTINATION, SOURCE(S)

Generated data may be written to the register 308 or the vertexdestination buffer 310. Output data is taken from the functional module302. Table 6 illustrates commands in the proposed assembler format whichwrite output to the register 308 or the vertex destination buffer 310.

TABLE 6 ADD R4,R1,R2 result goes into R4 ADD o[HPOS],R1,R2 result goesinto the destination buffer ADD R4.xy,R1,R2 result goes into x,ycomponents of R4

During operation, the programmable vertex processing is adapted forcarrying out various instructions of an instruction set using any typeof programming language including, but not limited to that set forthhereinabove. Such instructions may include, but are not limited to a nooperation, address register load, move, multiply, addition, multiply andaddition, reciprocal, reciprocal square root, three component dotproduct, four component dot product, distance vector, minimum, maximum,set on less than, set on greater or equal than, exponential base two(2), logarithm base two (2), and/or light coefficients. Table 7illustrates the operation code associated with each of the foregoinginstructions. Also indicated is a number of inputs and outputs as wellas whether the inputs and outputs are scalar or vector.

TABLE 7 INPUT(scalar or OUTPUT(replicated OPCODE vector) scalar orvector) NOP ARL s MOV v v MUL v,v v ADD v,v v MAD v,v,v v RCP s s,s,s,sor v or v or v RSQ s s,s,s,s, or v DP3 v,v s,s,s,s DP4 v,v s,s,s,s DSTv,v V MIN v,v V MAX v,v V SLT v,v V SGE v,v V EXP s V LOG s v LIT v v

As shown in Table 7, each of the instructions includes an input and anoutput which may take the form of a vector and/or a scalar. It should benoted that such vector and scalar inputs and outputs may be handled invarious ways. Further information on dealing with such inputs andoutputs may be had by reference to a co-pending application entitled“METHOD, APPARATUS AND ARTICLE OF MANUFACTURE FOR A TRANSFORM MODULE INA GRAPHICS PROCESSOR” filed Dec. 6, 1999 under Ser. No. 09/456,102 whichis incorporated herein by reference in its entirety.

These various instructions may each be carried out using a uniqueassociated method and data structure. Such data structure includes asource location identifier indicating a source location of data to beprocessed. Such source location may include a plurality of components.Further provided is a source component identifier indicating in which ofthe plurality of components of the source location the data resides. Thedata may be retrieved based on the source location identifier and thesource component identifier. This way, the operation associated with theinstruction at hand may be performed on the retrieved data in order togenerate output.

Also provided is a destination location identifier for indicating adestination location of the output. Such destination location mayinclude a plurality of components. Further, a destination componentidentifier is included indicating in which of the plurality ofcomponents of the destination location the output is to be stored. Inoperation, the output is stored based on the destination locationidentifier and the destination component identifier.

FIG. 5 is a flowchart illustrating the method 500 in which the foregoingdata structure is employed in carrying out the instructions inaccordance with one embodiment of the present invention. First, inoperation 502, the source location identifier is received indicating asource location of data to be processed. Thereafter, in operation 504,the source component identifier is received indicating in which of theplurality of components of the source location the data resides.

The data is subsequently retrieved based on the source locationidentifier and the source component identifier, as indicated inoperation 506. Further, the particular operation is performed on theretrieved data in order to generate output. See operation 508. Thedestination location identifier is then identified in operation 510 forindicating a destination location of the output. In operation 512, thedestination component identifier is identified for indicating in whichof the plurality of components of the destination location the output isto be stored. Finally, in operation 514, the output is stored based onthe destination location identifier and the destination componentidentifier.

Further information will now be set forth regarding each of theinstructions set forth in Table 7. In particular, an exemplary format,description, operation, and examples are provided using the programminglanguage set forth earlier.

Address Register Load (ARL)

Format:

ARL A0.x,[−]S0.[xyzw]

Description:

The contents of source scalar are moved into a specified addressregister. Source may have one subscript. Destination may have an “.x”subscript. In one embodiment, the only valid address register may bedesignated as “A0.x.” The address register “A0.x” may be used as a baseaddress for constant reads. The source may be a float that is truncatedtowards negative infinity into a signed integer.

Operation:

Table 8A sets forth an example of operation associated with the ARLinstruction.

TABLE 8A t.x = source0.c***;  /* c is x or y or z or w */ t.y =source0.*c**; t.z = source0.**c*; t.w = source0.***c; if (−source0)   t= −t; A0.x = TruncateTo-Infinity(t.x);Examples

ARL A0.x,v[7].w (move vertex scalar into address register 0)

MOV R6,c[A0.x+7] (move constant at address A0.x+7 into register R6)

Mov (MOV)

Format:

MOV D[.xyzw],[−]S0[.xyzw]

Description:

The contents of a designated source are moved into a destination.

Operation:

Table 8B sets forth an example of operation associated with the MOVinstruction.

TABLE 8B t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } if (xmask) destination.x = t.x; if (ymask) destination.y= t.y; if (zmask) destination.z = t.z; if (wmask) destination.w = t.w;Examples

MOV o[1],−R4 (move negative R4 into o[1])

MOV R5,v[POS].w (move w component of v[POS] into xyzw components of R5)

MOV o[HPOS],c[0] (output constant in location zero)

MOV R7.xyw,R4.x (move x component of R4 into x,y,w components of R7)

Multiply (MUL)

Format:

MUL D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction multiplies sources into a destination. It shouldbe noted that 0.0 times anything is 0.0.

Operation:

Table 8C sets forth an example of operation associated with the MULinstruction.

TABLE 8C t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } if (xmask) destination.x = t.x * u.x;if (ymask) destination.y = t.y * u.y; if (zmask) destination.z = t.z *u.z; if (wmask) destination.w = t.w * u.w;Examples

MUL R6,R5,c[CON5] R6.xyzw=R5.xyzw*c[CON5].xyzw

MUL R6.x,R5.w,−R7 R6.x=R5.w*−R7.x

Add (ADD)

Format:

ADD D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction adds sources into a destination.

Operation:

Table 8D sets forth an example of operation associated with the ADDinstruction.

TABLE 8D t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } if (xmask) destination.x = t.x + u.x;if (ymask) destination.y = t.y + u.y; if (zmask) destination.z = t.z +u.z; if (wmask) destination.w = t.w + u.w;Examples

ADD R6,R5.x,c[CON5] R6.xyzw=R5.x+c[CON5].xyzw

ADD R6.x,R5,−R7 R6.x=R5.x−R7.x

ADD R6,−R5,c[CON5] R6.xyzw=−R5.xyzw+c[CON5].xyzw

Multiply And Add (MAD)

Format:

MAD D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw],[−]S2[.xyzw]

Description:

The present instruction multiplies and adds sources into a destination.It should be noted that 0.0 times anything is 0.0.

Operation:

Table 8E sets forth an example of operation associated with the MADinstruction.

TABLE 8E t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } v.x = source2.c***; v.y =source2.*c**; v.z = source2.**c*; v.w = source2.***c; if (negate2) { v.x = −v.x;  v.y = −v.y;  v.z = −v.z;  v.w = −v.w; } if (xmask)destination.x = t.x * u.x + v.x; if (ymask) destination.y = t.y * u.y +v.y; if (zmask) destination.z = t.z * u.z + v.z; if (wmask)destination.w = t.w * u.w + v.w;Examples

MAD R6,−R5,v[POS],−R3 R6=−R5*v[POS]−R3

MAD R6.z,R5.w,v[POS],R5 R6.z=R5.w*v[POS].z+R5.z

Reciprocal (RCP)

Format:

RCP D[.xyzw],[−]S0.[xyzw]

Description:

The present instruction inverts a source scalar into a destination. Thesource may have one subscript. Output may be exactly 1.0 if the input isexactly 1.0.

RCP(−Inf) gives (−0.0,−0.0,−0.0,−0.0)

RCP(−0.0) gives (−Inf,−Inf,−Inf,−Inf)

RCP(+0.0) gives (+Inf,+Inf,+Inf,+Inf)

RCP(+Inf) gives (0.0,0.0,0.0,0.0)

Operation:

Table 8F sets forth an example of operation associated with the RCPinstruction.

TABLE 8F     t.x = source0.c;     if (negate0) {      t.x = −t.x;     }    if (t.x == 1.0f) {      u.x = 1.0f;     } else {      u.x = 1.0f /t.x;     }     if (xmask) destination.x = u.x;     if (ymask)destination.y = u.x;     if (zmask) destination.z = u.x;     if (wmask)destination.w = u.x;

-   -   where    -   |u.x−IEEE(1.0f/t.x)|>1.0f/(2^22)

for 1.0f<=t.x<=2.0f. The intent of this precision requirement is

that this amount of relative precision apply over all values of t.x.

Examples

RCP R2,c[A0.x+14].x R2.xyzw=1/c [A0.x+14].x

RCP R2.w,R3.z R2.w=1/R3.z

Reciprocal Square Root (RSQ)

Format:

RSQ D[.xyzw],[−]S0.[xyzw]

Description:

The present instruction performs an inverse square root of absolutevalue on a source scalar into a destination. The source may have onesubscript. The output may be exactly 1.0 if the input is exactly 1.0.

RSQ(0.0) gives (+Inf,+Inf,+Inf,+Inf)

RSQ(Inf) gives (0.0,0.0,0.0,0.0)

Operation:

Table 8G sets forth an example of operation associated with the RSQinstruction.

TABLE 8G   t.x = source0.c;   if (negate0) {    t.x = −t.x;   }   if(fabs(t.x) == 1.0f) {    u.x = 1.0f;   } else {    u.x = 1.0f /sqrt(fabs(t.x));   }   if (xmask) destination.x = u.x;   if (ymask)destination.y = u.x;   if (zmask) destination.z = u.x;   if (wmask)destination.w = u.x;

-   -   where    -   |u.x−IEEE(1.0f/sqrt(fabs(t.x)))|<1.0f/(2^22)

for 1.0f<=t.x<=4.0f. The intent of this precision requirement is

that this amount of relative precision apply over all values of t.x.

Examples

RSQ o[PA0],R3.y o[PA0]=1/sqrt(abs(R3.y))

RSQ R2.w,v[9].x R2.w=1/sqrt(abs(v[9].x))

Three Component Dot Product (DP3)

Format:

DP3 D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction performs a three component dot product of thesources into a destination. It should be noted that 0.0 times anythingis 0.0.

Operation:

Table 8H sets forth an example of operation associated with the DP3instruction.

TABLE 8H t.z = source0.c***; t.y = source0.*c**; t.z = source0.**c*; if(negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; } u.x = source1.c***;u.y = source1.*c**; u.z = source1.**c*; if (negate1) {  u.x = −u.x;  u.y= −u.y;  u.z = −u.z; } v.x = t.x * u.x + t.y * u.y + t.z * u.z; if(xmask) destination.x = v.x; if (ymask) destination.y = v.x; if (zmask)destination.z = v.x; if (wmask) destination.w = v.x;Examples

DP3 R6,R3,R4 R6.xyzw=R3.x*R4.x+R3.y*R4.y+R3.z*R4.z

DP3 R6.w,R3,R4 R6.w=R3.x*R4.x+R3.y*R4.y+R3.z*R4.z

Four Component Dot Product (DP4)

Format:

DP4 D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction performs a four component dot product of thesources into a destination. It should be noted that 0.0 times anythingis 0.0.

Operation:

Table 8I sets forth an example of operation associated with the DP4instruction.

TABLE 8I t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } v.x = t.x * u.x + t.y * u.y + t.z *u.z + t.w * u.w; if (xmask) destination.x = v.x; if (ymask)destination.y = v.x; if (zmask) destination.z = v.x; if (wmask)destination.w = v.x;Examples

DP4 R6,v[POS],c[MV0] R6.xyzw=v.x*c.x+v.y*c.y+v.z*c.z+v.w*c.w

DP4 R6.xw,v[POS].w,R3 R6.xw=v.w*R3.x+v.w*R3.y+v.w*R3.z+v.w*R3.w

Distance Vector (DST)

Format:

DST D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction calculates a distance vector. A first sourcevector is assumed to be (NA,d*d,d*d,NA) and a second source vector isassumed to be (NA,1/d,NA,1/d). A destination vector is then outputted inthe form of (1,d,d*d,1/d). It should be noted that 0.0 times anything is0.0.

Operation:

Table 8J sets forth an example of operation associated with the DSTinstruction.

TABLE 8J t.y = source0.*c**; t.z = source0.**c*; if (negate0) {  t.y =−t.y;  t.z = −t.z; } u.y = source1.*c**; u.w = source1.***c; if(negate1) {  u.y = −u.y;  u.w = −u.w; } if (xmask) destination.x = 1.0;if (ymask) destination.y = t.y*u.y; if (zmask) destination.z = t.z; if(wmask) destination.w = u.w;Examples

DST R2,R3,R4 R2.xyzw=(1.0,R3.y*R4.y,R3.z,R4,w)

Minimum (MIN)

Format:

MIN D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction determines a minimum of sources, and moves thesame into a destination.

Operation:

Table 8K sets forth an example of operation associated with the MINinstruction.

TABLE 8K t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } if (xmask) destination.x = (t.x < u.x)? t.x : u.x; if (ymask) destination.y = (t.y < u.y) ? t.y : u.y; if(zmask) destination.z = (t.z < u.z) ? t.z : u.z; if (wmask)destination.w = (t.w < u.w) ? t.w : u.w;Examples

MIN R2,R3,R4 R2=component min(R3,R4)

MIN R2.x,R3.z,R4 R2.x=min(R3.z,R4.x)

Maximum (MAX)

Format:

MAX D[.xyzw], [−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction determines a maximum of sources, and moves thesame into a destination.

Operation:

Table 8L sets forth an example of operation associated with the MAXinstruction.

TABLE 8L t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } if (xmask) destination.x = (t.x >=u.x) ? t.x : u.x; if (ymask) destination.y = (t.y >= u.y) ? t.y : u.y;if (zmask) destination.z = (t.z >= u.z) ? t.z : u.z; if (wmask)destination.w = (t.w >= u.w) ? t.w : u.w;Examples

MAX R2,R3,R4 R2=component max(R3,R4)

MAX R2.w,R3.x,R4 R2.w=max(R3.x,R4.w)

Set On Less Than (SLT)

Format:

SLT D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction sets a destination to 1.0/0.0 if source0 isless_than/greater_or_equal to source1. The following relationshipsshould be noted:

SetEQ R0,R1=(SGE R0,R1)*(SGE −R0,−R1)

SetNE R0,R1=(SLT R0,R1)+(SLT −R0,−R1)

SetLE R0,R1=SGE −R0,−R1

SetGT R0,R1=SLT −R0,−R1

Operation:

Table 8M sets forth an example of operation associated with the SLTinstruction.

TABLE 8M t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } if (xmask) destination.x = (t.x < u.x)? 1.0 : 0.0; if (ymask) destination.y = (t.y < u.y) ? 1.0 : 0.0; if(zmask) destination.z = (t.z < u.z) ? 1.0 : 0.0; if (wmask)destination.w = (t.w < u.w) ? 1.0 : 0.0;Examples

SLT R4,R3,R7 R4.xyzw=(R3.xyzw<R7.xyzw ? 1.0: 0.0)

SLT R3.xz,R6.w,R4 R3.xz=(R6.w<R4.xyzw ? 1.0: 0.0)

Set On Greater Or Equal Than (SGE)

Format:

SGE D[.xyzw],[−]S0[.xyzw],[−]S1[.xyzw]

Description:

The present instruction set a destination to 1.0/0.0 if source0 isgreater_or_equal/less_than source1.

Operation:

Table 8N sets forth an example of operation associated with the SGEinstruction.

TABLE 8N t.x = source0.c***; t.y = source0.*c**; t.z = source0.**c*; t.w= source0.***c; if (negate0) {  t.x = −t.x;  t.y = −t.y;  t.z = −t.z; t.w = −t.w; } u.x = source1.c***; u.y = source1.*c**; u.z =source1.**c*; u.w = source1.***c; if (negate1) {  u.x = −u.x;  u.y =−u.y;  u.z = −u.z;  u.w = −u.w; } if (xmask) destination.x = (t.x >=u.x) ? 1.0 : 0.0; if (ymask) destination.y = (t.y >= u.y) ? 1.0 : 0.0;if (zmask) destination.z = (t.z >= u.z) ? 1.0 : 0.0; if (wmask)destination.w = (t.w >= u.w) ? 1.0 : 0.0;Examples

SGE R4,R3,R7 R4.xyzw=(R3.xyzw>=R7.xyzw ? 1.0: 0.0)

SGE R3.xz,R6.w,R4 R3.xz=(R6.w>=R4.xyzw ? 1.0: 0.0)

Exponential Base 2 (EXP)

Format:

EXP D[.xyzw],[−]S0.[xyzw]

Description:

The present instruction performs an exponential base 2 partial support.It generates an approximate answer in dest.z, and allows for a moreaccurate answer of dest.x*FUNC(dest.y) where FUNC is some userapproximation to 2**dest.y (0.0 <=dest.y<1.0). It also accepts a scalarsource0. It should be noted that reduced precision arithmetic isacceptable in evaluating dest.z.

EXP(−Inf) or underflow gives (0.0,0.0,0.0,1.0)

EXP(+Inf) or overflow gives (+Inf,0.0,+Inf,1.0)

Operation:

Table 8O sets forth an example of operation associated with the EXPinstruction.

TABLE 8O     t.x = source0.c;     if (negate0) {      t.x = −t.x;     }    q.x = 2{circumflex over ( )}floor(t.x);     q.y = t.x − floor(t.x);    q.z = q.x * APPX(q.y);     if (xmask) destination.x = q.x;     if(ymask) destination.y = q.y;     if (zmask) destination.z = q.z;     if(wmask) destination.w = 1.0;

where APPX is an implementation dependent approximation of exponential

base 2 such that

-   -   |exp(q.y*log(2.0))−APPX(q.y)|<1/(2^11)

for all 0<=q.y<1.0.

The expression “2^floor(t.x)” should overflow to +Inf and underflow

to zero.

Examples

EXP R4,R3.z

Logarithm Base 2 (LOG)

Format:

LOG D[.xyzw],[−]S0.[xyzw]

Description:

The present instruction performs a logarithm base 2 partial support. Itgenerates an approximate answer in dest.z and allows for a more accurateanswer of dest.x+FUNC(dest.y) where FUNC is some user approximation oflog2(dest.y) (1.0<=dest.y<2.0). It also accepts a scalar source0 ofwhich the sign bit is ignored. Reduced precision arithmetic isacceptable in evaluating dest.z.

LOG(0.0) gives (−Inf,1.0,−Inf,1.0)

LOG(Inf) gives (Inf,1.0,Inf,1.0)

Operation:

Table 8P sets forth an example of operation associated with the LOGinstruction.

TABLE 8P     t.x = source0.c;     if (negate0) {      t.x = −t.x;     }    if (fabs(t.x) != 0.0f) {      if (fabs(t.x) == +Inf) {       q.x =+Inf;       q.y = 1.0;       q.z = +Inf;      } else {       q.x =Exponent(t.x);       q.y = Mantissa(t.x);       q.z = q.x + APPX(q.y);     }     } else {      q.x = −Inf;      q.y = 1.0;      q.z = −Inf;    }     if (xmask) destination.x = q.x;     if (ymask) destination.y =q.y;     if (zmask) destination.z = q.z;     if (wmask) destination.w =1.0;

-   -   if (wmask) destination.w=1.0;

where APPX is an implementation dependent approximation of logarithm

base 2 such that

-   -   |log(q.y)/log(2.0)−APPX(q.y)|<1/(2^11)

for all 1.0<=q.y<2.0.

Examples

LOG R4,R3.z

Light Coefficients (LIT)

Format:

LIT D[.xyzw],[−]S0[.xyzw]

Description:

The present instruction provides lighting partial support. It calculateslighting coefficients from two dot products and a power (which getsclamped to −128.0<power<128.0). The source vector is:

Source0.x=n*1 (unit normal and light vectors)

Source0.y=n*h (unit normal and halfangle vectors)

Source0.z is unused

Source0.w=power

Reduced precision arithmetic is acceptable in evaluating dest.z. Allowederror is equivalent to a power function combining the LOG and EXPinstructions (EXP(w*LOG(y))). An implementation may support at least 8fraction bits in the power. Note that since 0.0 times anything may be0.0, taking any base to the power of 0.0 will yield 1.0.

Operation:

Table 8Q sets forth an example of operation associated with the LITinstruction.

TABLE 8Q     t.x = source0.c***;     t.y = source0.*c**;     t.w =source0.***c;     if (negate0) {      t.x = −t.x;      t.y = −t.y;     t.w = −t.w;     }     if (t.w < −(128.0−epsilon)) t.w =−(128.0−epsilon);     else if (t.w > 128−epsilon) t.w = 128−epsilon;    if  (t.x < 0.0) t.x = 0.0;     if  (t.y < 0.0) t.y = 0.0;     if (xmask) destination.x = 1.0;     if  (ymask) destination.y = t.x;    if  (zmask) destination.z = (t.x > 0.0) ? EXP(t.w*LOG(t.y)) : 0.0;    if  (wmask) destination.w = 1.0;Examples

LIT R4,R3

Floating Point Requirements

In one embodiment, all vertex program calculations may be assumed to useIEEE single precision floating-point math with a format of s1e8m23 (onesigned bit, 8 bits of exponent, 23 bits of magnitude) or better and theround-to-zero rounding mode. Possible exceptions to this are the RCP,RSQ, LOG, EXP, and LIT instructions.

It should be noted that (positive or negative) 0.0 times anything is(positive) 0.0. The RCP and RSQ instructions deliver results accurate to1.0/(2^22) and the approximate output (the z component) of the EXP andLOG instructions only has to be accurate to 1.0/(2^11). The LITinstruction specular output (the z component) is allowed an errorequivalent to the combination of the EXP and LOG combination toimplement a power function.

The floor operations used by the ARL and EXP instructions may operateidentically. Specifically, the x component result of the EXP instructionexactly matches the integer stored in the address register by the ARLinstruction.

Since distance is calculated as (d^2)*(1/sqrt(d^2)), 0.0 multiplied byanything is 0.0. This affects the MUL, MAD, DP3, DP4, DST, and LITinstructions. Because if/then/else conditional evaluation is done bymultiplying by 1.0 or 0.0 and adding, the floating point computationsmay require;

0.0*x=0.0 for all x (including +Inf, −Inf, +NaN, and −Nan)

1.0*x=x for all x (including +Inf and −Inf)

0.0+x=x for all x (including +Inf and −Inf)

Including +Inf, −Inf, +Nan, and −Nan when applying the above three rulesis recommended but not required. (The recommended inclusion of +Inf,−Inf, +Nan, and −Nan when applying the first rule is inconsistent withIEEE floating-point requirements.)

No floating-point exceptions or interrupts are necessarily generated.Denorms may not necessarily be supported. If a denorm is input, it istreated as 0.0 (ie, denorms are flushed to zero).

Computations involving +Nan or −Nan generate +NaN, except for therecommendation that zero times +Nan or −Nan may always be zero. (Thisexception is inconsistent with IEEE floating-point requirements).

PROGRAMMING EXAMPLES

A plurality of program examples will now be set forth in Table 9.

Table 9

The #define statements are meant for a cpp run.

Example 1

%!VS1.0

; Absolute Value R4=abs(R0)

-   -   MAX R4,R0,−R0;

Example 2

% !VS1.0

; Cross Product |i j k | into R2

; |R0.x R0.y R0.z|

; |R1.x R1.y R1.z|

-   -   MUL R2,R0.zxyw,R1.yzxw;    -   MAD R2,R0.yzxw,R1.zxyw,−R2;

Example 3

%!VS1.0

; Determinant |R0.x R0.y R0.z| into R3

; |R1.x R1.y R1.z|

; |R2.x R2.y R2.z|

-   -   MUL R3,R1.zxyw,R2.yzxw;    -   MAD R3,R1.yzxw,R2.zxyw,−R3;    -   DP3 R3,R0,R3;

Example 4

%!VS1.0

; R2=matrix[3] [3]*v->onrm ,normalize and calculate distance vector R3

#define INRM 11; source normal

#define N0 16; inverse transpose modelview row 0

#define N4 17; inverse transpose modelview row 1

#define N8 18; inverse transpose modelview row 2

-   -   DP3 R2.x,v[INRM],c[N0];    -   DP3 R2.y,v[INRM],c[N4];    -   DP3 R2.z,v[INRM],c[N8];    -   DP3 R2.w,R2,R2;    -   RSQ R11.x,R2.w;    -   MUL R2.xyz,R2,R11.x;    -   DST R3,R2.w,R11.x;

Example 5

%!VS1.0

; reduce R1 to fundamental period

#define PERIOD 70; location PERIOD is 1.0/(2*PI),2*PI,0.0,0.0

-   -   MUL R0,R1,c[PERIOD].x; divide by period    -   EXP R4,R0;    -   MUL R2,R4.y,c[PERIOD].y; multiply by period

Example 6

%!VS1.0

; matrix[4] [4]*v->opos with homogeneous divide

#define IPOS 0; source position

#define M0 20; modelview row 0

#define M4 21; modelview row 1

#define MB 22; modelview row 2

#define M12 23; modelview row 3

-   -   DP4 R5.w,v[IPOS],c[M12];    -   DP4 R5.x,v[IPOS],c[M0];    -   DP4 R5.y,v[IPOS],c[M4];    -   DP4 R5.z,v[IPOS],c[M8];    -   RCP R11,R5.w;    -   MUL R5,R5,R11;

Example 7

%!VS1.0

; R4=v->weight.x*R2+(1.0-v->weight.x)*R3

#define IWGT 11; source weight

-   -   ADD R4,R2,−R3;    -   MAD R4,v[IWGT].x,R4,R3;

Example 8

%!VS1.0

; output transformed position, xform normal/normalize,

output two textures

#define IPOS 0; source position

#define INORM 11; source normal

#define ITEX0 3; source texture 0

#define ITEX1 4; source texture 1

#define OTEX0 3; destination texture 0

#define OTEX1 4; destination texture 1

#define N0 16; inverse transpose modelview row 0

#define N4 17; inverse transpose modelview row 1

#define N8 18; inverse transpose modelview row 2

#define C0 24; composite row 0

190 define C4 25; composite row 1

#define C8 26; composite row 2

#define C12 27; composite row 3

-   -   DP3 R2.x,v[INORM],c[N0];    -   DP3 R2.y,v[INORM],c[N4];    -   DP3 R2.z,v[INORM],c[N8];    -   MOV o[OTEX0],v[ITEX0];    -   DP3 R2.w,R2,R2;    -   RSQ R2.w,R2.w;    -   MUL R2,R2,R2.w; keep for later work    -   MOV o[OTEX1],v[ITEX1];    -   DP4 o[HPOS].w,v[IPOS],c[C12];    -   DP4 o[HPOS].x,v[IPOS],c[C0];    -   DP4 o[HPOS].y,v[IPOS],c[C4];    -   DP4 o[HPOS].z,v[IPOS],c[C8];

While various embodiments have been described above, it should beunderstood that they have been presented by way of example only, and notlimitation. Thus, the breadth and scope of a preferred embodiment shouldnot be limited by any of the above described exemplary embodiments, butshould be defined only in accordance with the following claims and theirequivalents.

1. A method for programmable processing in a computer graphics pipeline,comprising: receiving data from a buffer; performing programmableoperations on the data in order to generate output, wherein theoperations are programmable by a user utilizing instructions from apredetermined instruction set; and storing the output in memory; whereinthe output stored in memory is used in performing the programmableoperations on the data; wherein the predetermined instruction setincludes a reciprocal operation, a reciprocal square root operation, athree component dot product operation, a four component dot productoperation, a distance operation, a minimum operation, a maximumoperation, an exponential operation, and a logarithm operation; whereinthe instructions are each carried out using a unique associated methodand data structure.
 2. The method as recited in claim 1, wherein thereceiving, performing, and storing are processed for a single vertex ata time.
 3. The method as recited in claim 1, wherein the receiving,performing, and storing are processed for multiple vertexes in parallel.4. The method as recited in claim 1, wherein the data includes aconstant.
 5. The method as recited in claim 4, wherein the constant isstored in a constant source buffer.
 6. The method as recited in claim 5,wherein the constant is accessed in the constant source buffer using anabsolute or relative address.
 7. The method as recited in claim 1,wherein the data includes vertex data.
 8. The method as recited in claim1, wherein the memory has single write and triple read access.
 9. Themethod as recited in claim 1, and further comprising storing the outputin a destination buffer.
 10. The method as recited in claim 9, whereinthe output is stored in the destination buffer under a predeterminedreserved address.
 11. The method as recited in claim 1, and furthercomprising negating the data.
 12. The method as recited in claim 1, andfurther comprising swizzling the data.
 13. The method as recited inclaim 1, wherein the predetermined instruction set further includes a nooperation, an address register load, a move, a multiply, an addition, amultiply and addition, a set on less than, a set on greater or equalthan, an exponential base two, a logarithm base 2, and a lightcoefficient.
 14. The method as recited in claim 1, wherein each of theinstructions includes an input and an output which take the form of atleast one of a vector and a scalar.
 15. The method as recited in claim1, wherein the output includes a position of a vertex in homogeneousclip space.
 16. The method as recited in claim 15, wherein the positionis designated using Cartesian coordinates each with a normalized rangebetween −1.0 and 1.0.
 17. A method for programmable processing in acomputer graphics pipeline, comprising: receiving graphics dataincluding lighting information; and performing programmable operationson the graphics data in order to generate output, wherein the operationsare programmable by a user utilizing instructions from a predeterminedinstruction set; wherein the operations include a mathematical operationfor altering the lighting information of the graphics data; wherein thepredetermined instruction set includes a reciprocal operation, areciprocal square root operation, a three component dot productoperation, a four component dot product operation, a distance operation,a minimum operation, a maximum operation, an exponential operation, anda logarithm operation; wherein the instructions are each carried outusing a unique associated method and data structure.